Inno Setup Frequently Asked Questions |
Last Updated: 2006-06-26
Translating Inno Setup's text into another language does not require modifying the source code. Simply make a copy of the Default.isl file (included with Inno Setup) and start editing the text in it. (Do not directly edit the Default.isl file, otherwise your changes will be lost when you install a new Inno Setup version.) See the "[Messages] Section" topic in the Inno Setup help file for some important tips.
Once you have finished creating the new .isl file, create a [Languages] section to tell the compiler to use it:
[Languages]
Name: mytrans; MessagesFile: "compiler:MyTranslation.isl"If you're using a version of Inno Setup prior to 4.0, use this instead:
[Setup]
MessagesFile=compiler:MyTranslation.islThere are many contributed translations available for download on the Inno Setup Third-Party Files page, as well as a program to assist in editing the .isl file.
Inno Setup 2.0.6 adds complete support for MBCS. It does lead byte checking on all filename and constant parsing, so it should no longer mistake trail bytes for backslashes ("\") or braces ("{").
Versions prior to 2.0.6 did not include any special support for MBCS.
At the present time, I do not have plans for a Windows Installer edition of Inno Setup. "Supporting" Windows Installer would likely involve a near-complete rewrite of the program - something I don't have the time or interest to do.
The installer's icon may be changed by setting the SetupIconFile [Setup] section directive. To set the uninstaller's icon, set UninstallIconFile.
Inno Setup 4 adds support for this through the new Pascal Scripting feature.
Note: with earlier Inno Setup versions it was already possible to install different files depending on the Windows version.
No, and at the time of this writing I don't have plans to add such a feature.
No, nor is such a feature planned (it would be abused). If it is your intention to keep user interaction to a minimum, use the Disable* [Setup] section directives.
Yes. Use a {reg:...} constant in DefaultDirName. For example:
[Setup]
DefaultDirName={reg:HKLM\Software\My Program,Path|{pf}\My Program}
See the "Constants" topic in the Inno Setup help file for more information on {reg:...} constants.
This message is typically displayed if you try to embed a quote (") character in a parameter's data, but do not double it as required. Read the "Parameters in Sections" topic in the Inno Setup help file for more information.
Your application is most likely not specifying pathnames on the files it is trying to open, so it is expecting to find them in the current directory. Inno Setup by default does not set the "Start In" field on shortcuts its creates; this causes Windows to pick a directory itself, which usually won't be the directory containing your application.
In virtually all cases, this is something that should be corrected at the application level. Properly designed GUI applications should not expect to be started from a particular directory; they should always specify full pathnames on files they open. In Delphi or C++Builder, for example, it's possible to get the full pathname of the directory containing the application EXE by calling: ExtractFilePath(ParamStr(0)). To get the full path of a file named "File.txt" in the application directory, use: ExtractFilePath(ParamStr(0)) + 'File.txt'.
If for some reason you cannot fix this at the application level, you can tell Inno Setup to set the "Start In" field by adding "WorkingDir: {app}" to your [Icons] entries.
This error message is displayed when a file pertaining to the installation (e.g., setup.exe, setup.1) has the wrong size, or part of a file fails a CRC check. It is not displayed for any other reason.
If your installation is distributed over the internet and you're getting a lot of reports of this error, it could be that your web server is delivering partial files by dropping connections prematurely. Have the affected users check the size in the bytes of the file(s) they downloaded.
If your installation is distributed via CD-ROM or floppy disk, it could be that the CD-ROM or floppy disk is bad, or possibly the drive is defective.
This happens when you change AppId between versions, or if AppId is not specified, AppName. If you do that, Setup has no way of knowing that the two versions are of the same application, and thus will create a new entry in Add/Remove Programs. Additionally, a new uninstall log file (unins???.dat) will be created. The obvious solution for this is to not change AppId or AppName.
If you must change AppName in a new version, set AppId to the value of AppId or AppName from the previous version.
This message normally means that you specified the "regserver" flag on a file that doesn't possess the ability to be registered. Remove the "regserver" flag from the [Files] entry and the message will go away.
There are several reasons why a directory may not be removed:
- It already existed prior to installation. By default, the uninstaller plays it safe and doesn't remove directories that the installer didn't create.
- It contains files or subdirectories. Use [UninstallDelete] if you need the uninstaller to delete additional files/directories.
- A running process has the directory as its current directory.
Note: In Inno Setup versions prior to 2.0.1, directories must be specified in either the [Dirs] or [UninstallDelete] sections for them to be deleted by the uninstaller. In newer Inno Setup versions, directories created by [Files] section entries will be deleted automatically by the uninstaller if they didn't exist prior to installation.
From Tim Rude:
The simplest way to get a batch file to automatically close on exit is to clear the screen at the end of it using the CLS command.--- batch file 1 ---
@echo off
echo Hello World
echo This batch file does NOT close on exit--- batch file 2 ---
@echo off
echo Hello World
echo This batch file DOES close on exit
cls
At startup Setup looks in the registry to see if the same application was already installed previously, and if so, it will use the directory of the previous installation as the default directory presented to the user in the wizard. If you uninstall the application and run Setup again, it will use the new DefaultDirName setting. If you wish to disable this feature, set UsePreviousAppDir to "no".
Two files can't have the same name, and since shortcuts are files, two shortcuts therefore can't have the same name.
First, make sure that you are not using the "nowait" or "waituntilidle" flags on the [Run] entry. These flags prevent Setup from waiting until the process completely terminates.
If you aren't using those flags and it still doesn't seem to be waiting for the program to finish, then likely what is happening is that the EXE you're running is spawning some other process and then terminating itself immediately, causing Setup to think the program has finished. This is known to happen with older InstallShield-based installers (to work around it, try using the /SMS switch).
A simple way to check if a program does that is to run "START /WAIT ProgramName.exe" from the command line, and see if you are returned to the command prompt before the program exits.
Beginning with Inno Setup 4.2.2, languages specified in the [Languages] section that cannot be displayed under the active Windows ANSI code page are not listed in the Select Setup Language dialog. For example, Russian text can only be displayed properly if the active code page is 1251; if the user isn't running code page 1251 they will not see Russian as an option.
On Windows XP, the active code page may be changed by going to Regional and Language Options in Control Panel, and setting Language for non-Unicode programs on the Advanced tab. On Windows 2000, the active code page may be changed by going to Regional Options in Control Panel, and clicking Set default....
If you are sure you're running in the correct code page and a language still isn't being listed, then most likely LanguageCodePage is set incorrectly inside the language's .isl file.
If you would like to force all languages to be visible regardless of whether they can be displayed properly under the active code page, set the ShowUndisplayableLanguages [Setup] section directive (new in Inno Setup 5.1.7).
First create a file named, for example, "website.url", and place these lines inside it:
[InternetShortcut]
URL=http://web.site.address/Then add these lines to your script:
[Files]
Source: "website.url"; DestDir: "{app}"
[Icons]
Name: "{group}\Visit My Web Site"; Filename: "{app}\website.url"
Upgrade to at least Inno Setup 1.3.11, then use:
[Icons]
Name: "{userappdata}\Microsoft\Internet Explorer\Quick Launch\My Program"; Filename: "{app}\MyProg.exe"
Use a WorkingDir parameter on the [Icons] section entry.
First set the [Setup] section directive "ChangesAssociations" to "yes". Then create [Registry] entries as shown below.
[Registry]
Root: HKCR; Subkey: ".myp"; ValueType: string; ValueName: ""; ValueData: "MyProgramFile"; Flags: uninsdeletevalue".myp" is the extension we're associating. "MyProgramFile" is the internal name for the file type as stored in the registry. Make sure you use a unique name for this so you don't inadvertently overwrite another application's registry key.Root: HKCR; Subkey: "MyProgramFile"; ValueType: string; ValueName: ""; ValueData: "My Program File"; Flags: uninsdeletekey
"My Program File" above is the name for the file type as shown in Explorer.Root: HKCR; Subkey: "MyProgramFile\DefaultIcon"; ValueType: string; ValueName: ""; ValueData: "{app}\MYPROG.EXE,0"
"DefaultIcon" is the registry key that specifies the filename containing the icon to associate with the file type. ",0" tells Explorer to use the first icon from MYPROG.EXE. (",1" would mean the second icon.)Root: HKCR; Subkey: "MyProgramFile\shell\open\command"; ValueType: string; ValueName: ""; ValueData: """{app}\MYPROG.EXE"" ""%1"""
"shell\open\command" is the registry key that specifies the program to execute when a file of the type is double-clicked in Explorer. The surrounding quotes are in the command line so it handles long filenames correctly.
On Windows NT/2000/XP/2003, environment variables are stored as string values in the registry, so it is possible to manipulate them using the [Registry] section. System-wide environment variables are located at:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\EnvironmentUser-specific environment variables are located at:
HKEY_CURRENT_USER\EnvironmentOn Windows 95/98/Me, you'll need to modify AUTOEXEC.BAT to set environment variables. Inno Setup does not include any built-in feature for that, however you could write a small program to do that and execute it via the [Run] section (more info).
Inno Setup version 1.3.15 and later includes support for "closeonexit" and "dontcloseonexit" flags in the [Icons] section.
Inno Setup does not currently have a specific feature for doing that, but you can make a copy of a file before it is replaced by using a [Files] section entry similar to this:
Source: "{app}\MyProg.exe"; DestDir: "{app}\backup"; Flags: external skipifsourcedoesntexist uninsneveruninstall
That can be done via MinVersion and/or OnlyBelowVersion parameters on an entry. See the Common Parameters topic in the documentation for details.
Here is a simple example of how to install one file on NT platforms (Windows NT/2000/XP/2003) and another file on non-NT platforms (Windows 95/98/Me):
[Files]
Source: "{app}\WinNT2000XP.exe"; DestDir: "{app}"; MinVersion: 0, 1
Source: "{app}\Win9598Me.exe"; DestDir: "{app}"; MinVersion: 1, 0"0" means never install; "1" means install on any version (i.e. version 1.0 or later).
Note: The above technique isn't limited to the [Files] section; MinVersion and OnlyBelowVersion can be used in most sections.
Beginning with Inno Setup 4.1.0, the [Dirs], [Files], and [Registry] sections support Permissions parameters for setting permissions on directories, files, and registry keys respectively.
If you have more advanced needs, take a look at SetACL.
See the Knowledge Base article Implementing Custom Functionality.
The recommended way to install an OCX file is as follows.
[Files]
Source: "ComCtl32.ocx"; DestDir: "{sys}"; CopyMode: alwaysskipifsameorolder; Flags: restartreplace sharedfile regserver
If your application requires an updated version of COMCTL32.DLL, you can direct your users to download the COMCTL32 update from Microsoft, or call the COMCTL32 update from your installation by using the following lines:
[Files]
Source: "50comupd.exe"; DestDir: "{tmp}"
[Code]
function ShouldInstallComCtlUpdate: Boolean;
var
MS, LS: Cardinal;
begin
// Only install if the existing comctl32.dll is < 5.80
Result := False;
if GetVersionNumbers(ExpandConstant('{sys}\comctl32.dll'), MS, LS) then
if MS < $00050050 then
Result := True;
end;
[Run]
Filename: "{tmp}\50comupd.exe"; Parameters: "/r:n /q:1"; Check: ShouldInstallComCtlUpdateDon't try to install COMCTL32.DLL directly using the [Files] section; Microsoft does not allow this, and it's dangerous.
See the Knowledge Base article Installing BDE for details on deploying the 32-bit version of BDE using Inno Setup.
Currently supported platforms include Windows 95, 98, 2000, 2003, XP, Me, and NT 4.0. No service packs or other OS updates are required on any of the supported platforms.
I currently use and develop on Windows 2000 primarily, so Windows 2000 compatibility is foremost.
When new major features are introduced, I usually test them personally on all supported Windows versions.
The 16-bit version of Inno Setup was discontinued starting with version 1.3. Support for Windows NT 3.51 was discontinued starting with version 3.0.
A typical Inno Setup installation running on Windows NT/2000/XP/2003 does not require administrative or "power user" privileges. However, there are exceptions as noted below.
Things that require administrative privileges on both Windows NT/2000/XP/2003:
- Using "PrivilegesRequired=admin" in the script's [Setup] section. This causes Setup to abort with an error message if the user lacks administrative privileges.
- Using the "restartreplace" flag in the [Files] section. This flag causes Inno Setup to call the MoveFileEx function, which attempts to write to "HKEY_LOCAL_MACHINE\ SYSTEM\ CurrentControlSet\ Control\ Session Manager". Write access to this key is restricted to Administrators.
- Writing to any key under HKEY_USERS\.DEFAULT using the [Registry] section. Write access to this key is restricted to Administrators.
Things that require either administrative or "power user" privileges on Windows 2000/XP/2003:
- Using "PrivilegesRequired=poweruser" in the script's [Setup] section. This causes Setup to abort with an error message if the user lacks either administrative or "power user" privileges.
- Using the "regserver" flag in the [Files] section. In most cases registering a DLL involves writing to HKEY_CLASSES_ROOT, a privilege not granted to ordinary users.
- Using the "sharedfile" flag is the [Files] section. This flag causes Inno Setup to create/update a value in "HKEY_LOCAL_MACHINE\ SOFTWARE\ Microsoft\ Windows\ CurrentVersion\ SharedDLLs". Ordinary users are not allowed to write to that key.
- Using the FontInstall parameter in the [Files] section.
- Writing to any key under HKEY_LOCAL_MACHINE or HKEY_CLASSES_ROOT using the [Registry] section. Ordinary users are not allowed to write to those keys.
Inno Setup itself does not require write access to the WINNT directory, or any other registry keys not mentioned above.
What is different when an installation is run by a user without administrative privileges?
- The registry key for the Add/Remove Programs Control Panel entry is created under HKEY_CURRENT_USER instead of HKEY_LOCAL_MACHINE. Thus, only the user who installed the program will see an Add/Remove Programs entry for it.
- The "{group}" constant always points to the current user's profile, as opposed to the All Users profile.
- All "{common...}" constants are equivalent to the "{user...}" constants.
- The program may be uninstalled by any user. (When an administrator installs a program, only an administrator is allowed to uninstall it.)
Inno Setup places no arbitrary limits on how many files, shortcuts, registry entries, etc. that you may include in an installation. However, keep in mind that Setup does need memory for each entry in a script. For example, roughly 120 bytes of memory is needed for each [Files] entry.
In Inno Setup 3.x and earlier, installations and individual files cannot exceed 2 GB, because it does not use 64-bit arithmetic in most places. This has been addressed in Inno Setup 4.
When Cancel is clicked, Setup will begin reverting changes it's made so far in the very same manner as the Uninstall program. Thus, a partially installed application isn't left over.